<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HTML5 视频示例</title>
</head>

<body>
    <h1>HTML5 视频示例</h1>
    <video width="320" height="240" controls>
        <source src="https://www.runoob.com/try/demo_source/movie.mp4" type="video/mp4">
        <source src="https://www.runoob.com/try/demo_source/movie.ogg" type="video/ogg">
        您的浏览器不支持 HTML5 video 标签。
    </video>

    <script>
        window.onload = () => {
            // 设置音量为50%
            const video = document.querySelector('video');
            video.volume = 0.5;
            // 监听播放完毕
            video.addEventListener('ended', () => {
                console.log('视频播放完毕');
            });
        }
    </script>
</body>

</html>